package com.zzc.legou.search.clients;

import com.zzc.legou.item.entity.Spu;
import com.zzc.service.item.api.SpuApi;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@FeignClient(name = "item-service", fallback = SpuClient.SpuClientFallBack.class)
public interface SpuClient extends SpuApi {

    @Component
    @RequestMapping("/spu-fallback")
    class SpuClientFallBack implements SpuClient {
        private static final Logger LOGGER = LoggerFactory.getLogger(SpuClientFallBack.class);

        @Override
        public List<Spu> selectAll() {
            LOGGER.error("查找所有的spu信息失败");
            return null;
        }

        @Override
        public Spu edis(Long spuId) {
            return null;
        }
    }

}
